package com.ruoyi.system.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 用户会话（存储一对一/群聊会话信息）对象 user_session
 * 
 * @author ruoyi
 * @date 2025-09-12
 */
public class UserSession extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 会话唯一标识（主键） */
    private String id;

    /** 所属用户ID（关联用户表） */
    @Excel(name = "所属用户ID", readConverterExp = "关=联用户表")
    private Long userId;

    /** 目标ID（一对一聊天关联用户ID，群聊关联群聊ID） */
    @Excel(name = "目标ID", readConverterExp = "一=对一聊天关联用户ID，群聊关联群聊ID")
    private Long targetId;

    /** 最后一条消息ID（关联消息表） */
    @Excel(name = "最后一条消息ID", readConverterExp = "关=联消息表")
    private String lastMsgId;

    /** 最后一条消息时间（用于会话排序） */
    @Excel(name = "最后一条消息时间", readConverterExp = "用=于会话排序")
    private Date lastMessageTime;

    /** 未读消息数量 */
    @Excel(name = "未读消息数量")
    private Long unreadCount;

    /** 会话类型（1=一对一聊天，2=群聊） */
    @Excel(name = "会话类型", readConverterExp = "1==一对一聊天，2=群聊")
    private Long conversationType;

    /** 会话名称 */
    @Excel(name = "会话名称")
    private String sessionName;

    /** 会话头像URL */
    @Excel(name = "会话头像URL")
    private String avatar;

    /** 是否置顶（0=不置顶，1=置顶） */
    @Excel(name = "是否置顶", readConverterExp = "0==不置顶，1=置顶")
    private Long isTop;

    /** 是否免打扰（0=正常提醒，1=免打扰） */
    @Excel(name = "是否免打扰", readConverterExp = "0==正常提醒，1=免打扰")
    private Long isMute;

    /** 是否删除（0=正常，1=已删除） */
    @Excel(name = "是否删除", readConverterExp = "0==正常，1=已删除")
    private Long isDeleted;

    /** 乐观锁版本号（用于并发控制） */
    @Excel(name = "乐观锁版本号", readConverterExp = "用=于并发控制")
    private Long version;

    /** 创建人ID（关联用户表） */
    @Excel(name = "创建人ID", readConverterExp = "关=联用户表")
    private String creator;

    public void setId(String id) 
    {
        this.id = id;
    }

    public String getId() 
    {
        return id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getTargetId() {
        return targetId;
    }

    public void setTargetId(Long targetId) {
        this.targetId = targetId;
    }

    public void setLastMsgId(String lastMsgId)
    {
        this.lastMsgId = lastMsgId;
    }

    public String getLastMsgId() 
    {
        return lastMsgId;
    }

    public void setLastMessageTime(Date lastMessageTime) 
    {
        this.lastMessageTime = lastMessageTime;
    }

    public Date getLastMessageTime() 
    {
        return lastMessageTime;
    }

    public void setUnreadCount(Long unreadCount) 
    {
        this.unreadCount = unreadCount;
    }

    public Long getUnreadCount() 
    {
        return unreadCount;
    }

    public void setConversationType(Long conversationType) 
    {
        this.conversationType = conversationType;
    }

    public Long getConversationType() 
    {
        return conversationType;
    }

    public void setSessionName(String sessionName) 
    {
        this.sessionName = sessionName;
    }

    public String getSessionName() 
    {
        return sessionName;
    }

    public void setAvatar(String avatar) 
    {
        this.avatar = avatar;
    }

    public String getAvatar() 
    {
        return avatar;
    }

    public void setIsTop(Long isTop) 
    {
        this.isTop = isTop;
    }

    public Long getIsTop() 
    {
        return isTop;
    }

    public void setIsMute(Long isMute) 
    {
        this.isMute = isMute;
    }

    public Long getIsMute() 
    {
        return isMute;
    }

    public void setIsDeleted(Long isDeleted) 
    {
        this.isDeleted = isDeleted;
    }

    public Long getIsDeleted() 
    {
        return isDeleted;
    }

    public void setVersion(Long version) 
    {
        this.version = version;
    }

    public Long getVersion() 
    {
        return version;
    }

    public void setCreator(String creator) 
    {
        this.creator = creator;
    }

    public String getCreator() 
    {
        return creator;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("userId", getUserId())
            .append("targetId", getTargetId())
            .append("lastMsgId", getLastMsgId())
            .append("lastMessageTime", getLastMessageTime())
            .append("unreadCount", getUnreadCount())
            .append("conversationType", getConversationType())
            .append("sessionName", getSessionName())
            .append("avatar", getAvatar())
            .append("isTop", getIsTop())
            .append("isMute", getIsMute())
            .append("isDeleted", getIsDeleted())
            .append("version", getVersion())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .append("creator", getCreator())
            .toString();
    }
}
